package com.example.system.convert;

import com.example.system.dto.DeptDto;
import com.example.system.entity.Dept;
import com.example.system.vo.DeptVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author 王令
 * @since 2022/10/23 11:01
 */
@Mapper
public interface DeptConvert {

    DeptConvert INSTANCE = Mappers.getMapper(DeptConvert.class);

    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "tenantId", ignore = true)
    @Mapping(target = "deleted", ignore = true)
    @Mapping(target = "deleteTime", ignore = true)
    Dept toDept(DeptDto deptDto);


    @Mapping(target = "children", ignore = true)
    DeptVo toDeptVo(Dept dept);
}
